package com.lnsystem.service;

import java.util.List;

import org.joda.time.LocalDate;
import org.springframework.stereotype.Component;

import com.lnsystem.model.Stock;
import com.lnsystem.model.StockDailyData;
import com.lnsystem.model.StockDataType;

//consider extending this interface if different flavors of the methods in this interface are
// needed in the future.

public interface ScheduledTask {
	
	/**
	 * updates the stock symbols list in stock table
	 */
	public void updateSymbols(); // get the latest list of stocks and update the database.
	
	/**
	 * for all stocks(symbols), if stock exists in database, this method gets the today's data
	 * else it downloads the historical data
	 * and finally calculates sma10,sma50,sma200,ema10,ema8 and optionally bollinger values
	 */
	public void downloadDailyData();  // for all symbols, get basic data like symbol, name, index name (NYSE,NASDAQ etc)
		
	
	
	/**
	 * if stock exists in database, this method gets the  data for the given date
	 * else it downloads the historical data
	 * and finally calculates sma10,sma50,sma200,ema10,ema8 and optionally bollinger values
	 * @param s - the stock symbol
	 * @param date - the date
	 */
	//TODO to implement this, we have to use historical url with start date & end date as the given date (parameter)
	//void downloadStockData(String s, LocalDate date);
	
	
	/**
	 * gets the historical data for all symbols and calculates sma10,sma50,sma200, and optionally ema10,ema8,bollinger values
	 * @param datatype = DAILY/WEEKLY
	 * @param startDate - the start date. Default=this day of last year.
	 * @param endDate - the end date. Default= today.
	 */
	public void downloadHistoricalData(StockDataType datatype, String startDate, String endDate); // for all symbols, one-time job to download historical data and calculate TI

	
	/**
	 * gets the historical data for a specific stock.
	 * @param s - the stock symbol
	 * @param startDate - the start date. Default=this day of last year.
	 * @param endDate - the end date. Default= today.
	 * @param datatype = DAILY/WEEKLY
	 */
	public void downloadHistoricalData(String s, String startDate, String endDate, StockDataType dataType);

	
	/**
	 * updates the price action to G=Green, R=Red, B=Black or H=Hollow for a given day using dailyData.
	 * @param dailyData - the stockdailyData (used mostly for today)
	 * @return returns the price action string G,R,B,H 
	 */
	String updatePriceAction(StockDailyData dailyData);

	
	/**
	 * updates the price action to G=Green, R=Red, B=Black or H=Hollow for all days in dailyDataList.
	 * @param stock - the stock object
	 * @param dailyDataList - the stockdailyData list 
	 * 
	 * @return returns the price action string G,R,B,H 
	 */
	void updatePriceAction(Stock stock, List<StockDailyData> dailyDataList);
	
	/*
	public void calculateMovingAverages(); 
	public void calculateBollingerBandValues();
	*/
}
